package ar.edu.itba.it.paw.web;

import java.util.HashMap;
import java.util.Map;

import ar.edu.itba.it.paw.domain.Product;

public class SystemUser{
	
	private Integer user_id;
	String username;
	String password;
	String name;
	String last_name;
	String mail;
	Map<Integer,Product> products;
	
	private static Integer autonumeric = 0;
	
	public SystemUser(String usuario, String pass, String nombre, String apellido, String mail){
		this.user_id = autonumeric++;
		this.username = usuario;
		this.password = pass;
		this.name = nombre;
		this.last_name = apellido;
		this.mail = mail;
		this.products = new HashMap<Integer,Product>();
	}

	public Integer getUser_id() {
		return user_id;
	}

	public void setUser_id(Integer user_id) {
		this.user_id = user_id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLast_name() {
		return last_name;
	}

	public void setLast_name(String last_name) {
		this.last_name = last_name;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public Map<Integer, Product> getProducts() {
		return products;
	}

	public void setProducts(Map<Integer, Product> products) {
		this.products = products;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((user_id == null) ? 0 : user_id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SystemUser other = (SystemUser) obj;
		if (user_id == null) {
			if (other.user_id != null)
				return false;
		} else if (!user_id.equals(other.user_id))
			return false;
		return true;
	}

	
	
}